package C30;

/**
 * ClassName: Code06_OneKindNumberLessMtimes
 * Package: C30
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/12/17 15:45
 * @Version 1.0
 * @Since 1.0
 */
public class Code06_OneKindNumberLessMtimes {
    public static void main(String[] args) {
        int[] arr = {1,2,2,2,3,3,3,1,1,12,13,13,13};
        System.out.println(process(arr, 3));
    }

    public static int process(int[] arr, int m) {
        int eorAll = 0;
        int[]  cnt = new int[32];
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < 32; j++) {
                cnt[j] += arr[i] >> j & 1;
            }
        }
        int res = 0;
        for (int i = 0; i < 32; i++) {
            if(cnt[i] % m != 0) {
                res |= 1 << i;
            }
        }
        return res;
    }
}
